package
{
	import com.yzy.loader.DataLoader;
	import com.yzy.tool.ReadFile;
	
	import flash.display.Sprite;
	import flash.net.URLLoaderDataFormat;
	
	[SWF(width="1000",height="800", backgroundColor="0x000000")]
	public class Draw extends Sprite
	{
		private var disNumArr:Array;
		private var numVer:Vector.<NumObj>;
		private var Yunit:Number;
		private var Xunit:Number;
		public function Draw()
		{
			DataLoader.loaderData("appearNum.txt",loaderComplete,loaderProgress,URLLoaderDataFormat.TEXT);
		}
		
		private function loaderComplete(data:String):void
		{
			disNumArr=data.split("\r\n");
			//
			DataLoader.loaderData("20130224.txt",dataloaderComplete,loaderProgress,URLLoaderDataFormat.TEXT);
		}
		
		private function dataloaderComplete(data:String):void
		{
			numVer=ReadFile.strToVector(data,NumObj,Vector.<NumObj>) as Vector.<NumObj>;
			trace(numVer.length);
			
			
			
			drawGraphics();
		}
		
		
		private function drawGraphics():void{
			Yunit=this.stage.stageHeight/disNumArr.length;
			Xunit=this.stage.stageWidth/numVer.length;
			//
			this.graphics.lineStyle(1);
			this.graphics.moveTo(0,0);
			//
			for (var i:int = 0; i < numVer.length; i++) 
			{
				for (var j:int = 0; j < disNumArr.length; j++) 
				{
					if(numVer[i].number==disNumArr[j]){
						var currXPoint:Number=i*Xunit;
						var currYPoint:Number=j*Yunit;
						this.graphics.lineTo(currXPoint,currYPoint);
						this.graphics.drawCircle(currXPoint,currYPoint,2);
					}
				}
				
			}
			
		}
		
		
		
		
		
		
		
		private function loaderProgress(bytesTotal:Number,bytesLoaded:Number):void
		{
			// TODO Auto Generated method stub
		}
	}
}